#include<bits/stdc++.h>
#define XH(i,a,b) for(int i=a;i<b;++i)
#define XXH(i,a,b) for(int i=a-1;i>=b;--i)
#define LL long long
using namespace std;
int tmpINT; string tmpSTRING; char tmpCHAR; double tmpDOUBLE; LL tmpLONGLONG;

int main(){
	LL B,C;cin>>B>>C;
	LL ans = 0;
	int fu = 0;
	if(B<0){
		fu=1;
		B*=-1;
		C--;
	}
	ans += C/2>=B?B*2+1:(C/2+1)*2;
	if(C%2 == 0 && C/2<B)ans--;

	if(fu == 0){
		if(B!=0)C--;
	}else{
		C++;
	}
	
	ans += C/2*2;
	if(C%2 == 0 && C!=0)ans--;
	cout<<ans<<endl;
	
	return 0;
}